﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.ComponentModel;
namespace OtherDevice
{
    [Description("光源控制器-沃德普PD4")]
    public class Light_Wordop:LightCtrlBase
    {
        public Light_Wordop()
        {
            controlFrom = new XNCLightCtrl();
        }
        public override int Close(int channel)
        {
            throw new NotImplementedException();
        }

        public override int CloseAll()
        {
            throw new NotImplementedException();
        }

        public override int Get(int channel)
        {
            throw new NotImplementedException();
        }
        public override int Open(int channel)
        {
            throw new NotImplementedException();
        }

        public override int Set(int channel, int value, bool wait = true)
        {
            try
            {
                string ReadCMD = $"$ID=000,L{channel}={value}#";
                ReadCMD = ReadCMD.Trim();
                byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(ReadCMD);
                int ret = SendData(byteArray, 2000);
                byte[] S = null;
                ReceiveData(ref S, 3000);
                return 0;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show($"光源设置失败{ex}");
                return 0;
            }
        }
    }
}